package com.huawei.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Customer {

    // 定义常量为每个数字定义命名状态
    public static final Integer STATUS_POTENTIAL = 0;
    public static final Integer STATUS_NORMAL = 1;
    public static final Integer STATUS_POOL = 2;
    public static final Integer STATUS_FAILED = 3;
    public static final Integer STATUS_LOSE = 4;

    private Long id;

    private String name;

    private Integer age;

    private Integer gender;

    private String tel;

    private String qq;

    private Systemdictionaryitem job; // 职业

    private Systemdictionaryitem source; // 来源

    private Employee seller; // 销售人员

    private Employee inputUser; // 录入人

    private Date inputTime; // 录入时间

    private Integer status = STATUS_POTENTIAL; // 状态

    public String getJson(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("age",age);
        map.put("gender",gender);
        map.put("tel",tel);
        map.put("qq",qq);
        map.put("jobId",job.getId());
        map.put("sourceId",source.getId());
        map.put("sellerId",seller.getId());
        map.put("sellerName",seller.getName());
        return JSON.toJSONString(map);
    }

}